<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$('#member_pass').focus();
	$('#submit').click(function() {
		if($('#member_pass').val()==""){
			alert("비밀번호를 입력해 주세요.");
			$('#member_pass').focus();
		}else if($('#pass_check').val()==""){
			alert("비밀번호를 다시 한 번 입력해 주세요.");
			$('#pass_check').focus();
		}else{
			if($('#member_pass').val()==$('#pass_check').val()){
				$.ajax({
					type:'post',
					url:'member.do',
					data: $('#updateForm').serialize(),
					dataType:'json',
		
					success:function(data){
						if(data.result){
							alert("비밀번호가 변경되었습니다.");
							$('#member_pass').val("");
							$('#pass_check').val("");
						}else{
							alert("비밀번호 변경에 실패했습니다.");
							$('#member_pass').select();
						}
					}
				});//ajax
			}else{
				alert("비밀번호가 서로 일치하지 않습니다.");
				$('#pass_check').select();
			}
		}
	});
});
</script>
</head>
<body>
<c:import url="my_header.jsp"/><p>

<form id="updateForm">
<input type="hidden" name="command" value="updatePass">
새 비밀번호
<input name="member_pass" type="password" id="member_pass">
새 비밀번호 확인
<input type="password" id="pass_check">
</form>
<a href="#" id="submit">변경</a>
</body>
</html>